import { reactive } from "vue";
import { defineStore } from 'pinia';

export const useAuthorityStore = defineStore('authority', {
    state: () => ({
        // 当前选中的组织ID  
        selectedAuthorityNode: null,
        authorityModel: reactive({
            id: '',
            authorityName: '',
            pid: '',
            pName: '',
            authorityType: null,
            menuId: '',
            menuName: '',
            addTime: null,
            addUserId: '',
            editTime: null,
            editUserId: '',
            checked: true,
        })
    }),
    actions: {
        // 更新当前选中的组织ID  
        setSelectedAuthorityNode(authority) {
            this.selectedAuthorityNode = authority;
        },
        resetAuthorityModel() {
            this.authorityModel = {
                id: '',
                authorityName: '',
                pid: '',
                pName: '',
                authorityType: null,
                menuId: '',
                addTime: null,
                addUserId: '',
                editTime: null,
                editUserId: '',
                checked: true,
            };
        }
    },
    getters: {
        // 获取当前选中组织的名称  
        selectedAuthorityName: () => {

        },
    },
});